package com.shanzmoo.db.module.member.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.shanzmoo.db.module.member.entity.MemberCardConfigDetailEntity;
import com.shanzmoo.db.module.member.mapper.MemberCardConfigDetailMapper;
import com.shanzmoo.db.module.member.service.IMemberCardConfigDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 门店会员卡管理 服务实现类
 * </p>
 *
 * @author wangyudi
 * @since 2021-03-30
 */
@Service
public class MemberCardConfigDetailServiceImpl extends ServiceImpl<MemberCardConfigDetailMapper, MemberCardConfigDetailEntity> implements IMemberCardConfigDetailService {

    @Override
    public void deleteByConfigId(Integer id) {
        remove(
          new LambdaQueryWrapper<MemberCardConfigDetailEntity>()
          .eq(MemberCardConfigDetailEntity::getCardConfigId,id)
        );
    }

    @Override
    public List<MemberCardConfigDetailEntity> getbyConfigId(Integer id) {
        return list(
                new LambdaQueryWrapper<MemberCardConfigDetailEntity>()
                .eq(MemberCardConfigDetailEntity::getCardConfigId,id)
                .eq(MemberCardConfigDetailEntity::getDeleted,false)
        );
    }
}
